﻿namespace NavigationSampleWinForms.Views.Data
{
    using Smart.Navigation;
    using Smart.Navigation.Parameter;

    /// <summary>
    /// 
    /// </summary>
    [View(ViewId.DataDetailNew)]
    [View(ViewId.DataDetailEdit)]
    public partial class DataDetailView : AppViewBase
    {
        [ViewParameter(Direction.Import)]
        protected string SelectedId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DataDetailView()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void OnViewOpen(ViewForwardEventArgs args)
        {
            // ファンクションキー
            FunctionCotrol.UpdateFunctionKeys(null);

            // 表示
            if ((ViewId)args.ViewId == ViewId.DataDetailEdit)
            {
                MessageLabel.Text = "編集データID " + SelectedId;
            }
            else
            {
                MessageLabel.Text = "新規作成";
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonExit()
        {
            Navigator.Pop();
        }
    }
}
